/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.*;

/*
 */
public class ChargeDataBase {
    


  public ChargeDataBase() {};

  public void insertValues (String tiempo) {
    try {
        String driver = "org.gjt.mm.mysql.Driver";
        String url = "jdbc:mysql://localhost:3306/sudoku";
        String username = "root";
        String password = "gordo1513";

        Class.forName(driver);
        Connection connection = DriverManager.getConnection(url, username, password);
        Statement statement = connection.createStatement();
        String query = "insert into Tablero (Tiempo) values('"+tiempo+"')";
        statement.executeUpdate(query);
    }
    catch(ClassNotFoundException cnfe) {
      System.err.println("Error loading driver: " + cnfe);
    }
    catch(SQLException sqle) {
      try{
         System.err.println("Error Se producjo una Excepción accediendo a la base de datoas: " + sqle);
         sqle.printStackTrace();
      }
      catch(Exception e) {
         e.printStackTrace();
      }
    }


  }
}